<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>超市账单管理系统-客户管理</title>
    <link type="text/css" rel="stylesheet" href="../css/style.css">
</head>
<body>
<div class="menu">
    <table>
        <tbody>
        <tr>
            <td>
                <form method="post" action="${pageContext.request.contextPath}/customer/search">
                    <input name="method" value="query" class="input-text" type="hidden">
                    客户名称：<input name="customerName" class="input-text" type="text" value="${param.customerName}">
                    <input value="查 询" type="submit">
                </form>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="main">
    <div class="optitle clearfix">
        <em><input value="添加客户" class="input-button" onclick="window.location='customerAdd.jsp'" type="button"></em>
        <div class="title">客户管理&gt;&gt;</div>
    </div>
    <div class="content">
        <c:if test="${empty requestScope.customers}">
            <div class="empty-tip">暂无客户数据</div>
        </c:if>
        <c:if test="${not empty requestScope.customers}">
            <table class="list">
                <tbody>
                <tr>
                    <td width="70" height="29"><div class="STYLE1" align="center">编号</div></td>
                    <td width="80"><div class="STYLE1" align="center">客户姓名</div></td>
                    <td width="100"><div class="STYLE1" align="center">联系电话</div></td>
                    <td width="100"><div class="STYLE1" align="center">会员级别</div></td>
                    <td width="150"><div class="STYLE1" align="center">入会时间</div></td>
                    <td width="120"><div class="STYLE1" align="center">操作</div></td>
                </tr>
                <c:forEach items="${requestScope.customers}" var="customer">
                    <tr>
                        <td width="70" height="29"><div>${customer.customerID}</div></td>
                        <td width="80"><div>${customer.customerName}</div></td>
                        <td width="100"><div>${customer.customerPhone}</div></td>
                        <td width="100"><div>${customer.membershipLevel}</div></td>
                        <td width="150"><div>
                            <fmt:formatDate value="${customer.registerDate}" pattern="yyyy-MM-dd" />
                        </div></td>
                        <td width="120"><div>
                            <input type="button" value="编辑" class="input-button"
                                   onclick="window.location='${pageContext.request.contextPath}/customer/showdetail?customerID=${customer.customerID}'">
                            <input type="button" value="删除" class="input-button"
                                   onclick="if(confirm('确定删除该客户？')){window.location='${pageContext.request.contextPath}/customer/delete?customerID=${customer.customerID}';}">
                        </div></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </c:if>
    </div>
</div>
</body>
</html>